import Vue from 'vue'
import App from './App.vue'
import router from './router'
import './assets/global.css'
import './plugins/element.js'
import axios from 'axios'
import ElementUI from 'element-ui'
import { read, utils } from "xlsx"
// import VueCookies from 'vue-cookies'

// Vue.use(VueCookies)
//配置axios根路径
//axios.defaults.baseURL = "http://192.168.8.106:8081"
// axios.defaults.baseURL = "/"
axios.defaults.baseURL = "http://localhost:8081"

// axios.defaults.baseURL = "http://127.20.10.3:8080"

Vue.prototype.$axios = axios
// 响应拦截器
axios.interceptors.response.use(response => {
  //console.log(response.data);
  if (response.data.status === 400)
    ElementUI.Message({
      message: response.data.msg,
      type: 'warning'
    });

  return response;
})

// //axios 请求拦截
axios.interceptors.request.use(config => {
  // //为请求头对象，添加token验证的authorization字段
  config.headers.Authorization = window.sessionStorage.getItem('token')
  return config
})
//axios.defaults.withCredentials=true;
Vue.config.productionTip = false

new Vue({
  router,
  render: h => h(App)
}).$mount('#app')